var app = sm("do_App");
var page = sm("do_Page");
var hashdata = mm("do_HashData");
var nf = sm("do_Notification");
var allpage = require("helper/allpage");
var openHelper = require("helper/open");
var userUtil = require("helper/user");

var rootview = ui("$");
var layoutLogin = ui("layoutLogin");
var headRight2=ui("headRight2");

layoutLogin.on("touch", function() {
	//openHelper.open("source://view/user/main.ui");
});
headRight2.on("touch",function(){
	openHelper.open("source://view/search/search.ui");
})
//ui("imgUserLogo").source=userUtil.defaultLogo();

if(userUtil.loginToken()!=""&&userUtil.userLogo()!==""&&userUtil.userId()!==""){
	//ui("imgUserLogo").source=userUtil.userLogo();
}
app.on("fireUserUpdate",function(d){
	if(d.logo&&d.logo!==""){
		//ui("imgUserLogo").source=d.logo;
		userUtil.userLogo(d.logo);
	}
    if(d.nick&&d.nick!==""){
		userUtil.userNick(d.nick);
	}
    if(d.hasIdentityAuth&&d.hasIdentityAuth!==""){
		userUtil.hasIdentityAuth(d.hasIdentityAuth);
	}
});

app.on("fireUserLogout",function(d){
	//ui("imgUserLogo").source=userUtil.defaultLogo();
});